home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 1445 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: ux4.cso.uiuc.edu!djhoward
  2. From: djhoward@ux4.cso.uiuc.edu (howard daniel joseph)
  3. Newsgroups: comp.sys.amiga.programmer,uiuc.class.cs110c,uiuc.class.cs223
  4. Subject: Re: How do I define my integers?
  5. Followup-To: comp.sys.amiga.programmer,uiuc.class.cs110c,uiuc.class.cs223
  6. Date: 18 Jan 1996 19:57:48 GMT
  7. Organization: University of Illinois at Urbana
  8. Approved: Mu
  9. Message-ID: <4dm8ns$5kl@vixen.cso.uiuc.edu>
  10. References: <4d73ug$25v@vixen.cso.uiuc.edu> <30FD580D.4731@coewl.cen.uiuc.edu> <4djs0k$rub@vixen.cso.uiuc.edu>
  11. NNTP-Posting-Host: dclsn34.cen.uiuc.edu
  12. To: uiuc-class-cs110c@ux1.cso.uiuc.edu
  13. X-Newsreader: TIN [version 1.2 PL2]
  14. Status: R
  15. Content-Length: 1410
  16.  
  17. Ted Liu (dcn@uiuc.edu) wrote:
  18. : In article <30FD580D.4731@coewl.cen.uiuc.edu>, m-han3 says...
  19. : >howard daniel joseph wrote:
  20. : >> Can I perform simple maths (addition, division) between integers of
  21. : >> different types? I'd assume so, right?
  22.  
  23. : >Yes, you can.  But they will be converted according to the order of the
  24. : >evaluation of the expression.  You may lose precision sometimes.
  25.  
  26. : I thought when u perform some arithmetic on numbers of different types the 
  27. : smaller type is upgraded (like if u add an int and a float, the int is 
  28. : upgraded to a float before the arithmetic operation).  No precision would be 
  29. : lost.  Is this correct?
  30.  
  31.     Most responses I've received have said that ints of lower byte 
  32. count are promoted to higher byte count ... though operative order may 
  33. affect this if ie your adding the value of a long to a short ... why 
  34. bother promoting the short to a long when all you want is a short? 
  35. (Keeping stupid people from overflowing the short perhaps, but you 
  36. needn't add a long to do that ...)
  37.  
  38. --
  39. =====///====================================================================
  40. ====///=======This message brought to you by dannyman@uiuc.edu==============
  41. \\\///=========HOME PAGE! http://www.uiuc.edu/ph/www/djhoward ==============
  42. =\XX/A1200==================================================================
  43.     My views are my own, and not those of my employer or UIUC. Happy Jim?
  44.  
  45.